<?php

namespace Database\Seeders;

use App\Models\Dic;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class DicSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        Dic::factory(12)->create();

        $data = [
            [
                'name' => '用户状态',
                'code' => 'user_status',
                'description' => '盲盒状态',
                'status' => 1,
            ],
            [
                'name' => '角色状态',
                'code' => 'role_status',
                'description' => '状态',
                'status' => 1,
            ],
            [
                'name' => '商品分类状态',
                'code' => 'shopcate_status',
                'description' => '状态',
                'status' => 1,
            ],
            [
                'name' => '商品状态',
                'code' => 'shop_status',
                'description' => '状态',
                'status' => 1,
            ],
            [
                'name' => '盲盒分类状态',
                'code' => 'blindcate_status',
                'description' => '状态',
                'status' => 1,
            ],
            [
                'name' => '盲盒状态',
                'code' => 'blind_status',
                'description' => '盲盒状态',
                'status' => 1,
            ],
            [
                'name' => '盲盒类型',
                'code' => 'blind_type',
                'description' => '盲盒状态',
                'status' => 1,
            ],
            [
                'name' => '抽奖方式',
                'code' => 'reward_type',
                'description' => '抽奖方式',
                'status' => 1,
            ],
            [
                'name' => '规格状态',
                'code' => 'norm_type',
                'description' => '抽奖方式',
                'status' => 1,
            ],
            [
                'name' => '订单状态',
                'code' => 'order_status',
                'description' => '订单状态',
                'status' => 1,
            ],
            [
                'name' => '奖励类型',
                'code' => 'intergral_type',
                'description' => '奖励类型',
                'status' => 1,
            ],
            [
                'name' => '积分类型',
                'code' => 'inte_type',
                'description' => '积分类型',
                'status' => 1,
            ],
        ];
        foreach ($data as $key => $value) {
            $cate = Dic::where('id', $key + 1)->first();
            $cate->name = $value['name'];
            $cate->code = $value['code'];
            $cate->status = $value['status'];
            $cate->order = $key + 1;
            $cate->description = $value['description'];
            $cate->save();
        }
    }
}
